package summer_vacation.qiuyangyang;
import java.util.Scanner;
/**
 * Created by Administrator on 2015/8/26 0026.
 */
public class Assignment_09 { public static void main(String[] args){
    Scanner in=new Scanner(System.in);
    System.out.println("请输入数字:");
    int x=in.nextInt();
    int a,b,c,d,m;
    a=x%10;
    b=(x-a)%100/10;
    c=(x-a-b*10)%1000/100;
    d=(x-a-b-c)/1000;
    m=a*a+b*b+c*c+d*d;
    System.out.println(m);
}
}
